From 214bd481639b08c3e636ff3c85893f2ac132d576 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Agust=C3=ADn=20Mart=C3=ADn?= Date: Mon, 3 Dec 2012 18:15:32 +0100 Subject: [PATCH] ispell.el: Use expanded values of personal dictionary for process restart checks. (ispell-internal-change-dictionary): Improve ispell process restart checks by using expanded values for ispell personal dictionary and for related restart check. (ispell-start-process): * Remove apparently redundant code that seems better handled from (ispell-internal-change-dictionary) * No longer need to expand ispell personal dictionary, it is already expanded. Fixes: debbugs:13019 --- lisp/ChangeLog | 3 ++- lisp/textmodes/ispell.el | 21 +++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 89c10440788..503added5cc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,7 +2,8 @@ * textmodes/ispell.el (ispell-init-process) (ispell-start-process): Make sure personal dictionary name is - expanded after initial `default-directory' value (Bug#13019). + expanded after initial `default-directory' value. Use expanded + values for keep/restart checks (Bug#13019). 2012-12-03 Jay Belanger diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 81468fad85f..961fb1bad83 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -2649,11 +2649,8 @@ When asynchronous processes are not supported, `run' is always returned." (defun ispell-start-process () "Start the Ispell process, with support for no asynchronous processes. Keeps argument list for future Ispell invocations for no async support." - ;; Local dictionary becomes the global dictionary in use. - (setq ispell-current-dictionary - (or ispell-local-dictionary ispell-dictionary)) - (setq ispell-current-personal-dictionary - (or ispell-local-pdict ispell-personal-dictionary)) + ;; `ispell-current-dictionary' and `ispell-current-personal-dictionary' + ;; are properly set in `ispell-internal-change-dictionary'. (let* ((default-directory (if (and (file-directory-p default-directory) (file-readable-p default-directory)) @@ -2668,9 +2665,7 @@ Keeps argument list for future Ispell invocations for no async support." (list "-d" ispell-current-dictionary)) orig-args (if ispell-current-personal-dictionary ; Use specified pers dict. - (list "-p" - (expand-file-name ispell-current-personal-dictionary - current-ispell-directory))) + (list "-p" ispell-current-personal-dictionary)) ;; If we are using recent aspell or hunspell, make sure we use the ;; right encoding for communication. ispell or older aspell/hunspell ;; does not support this. @@ -2900,13 +2895,15 @@ By just answering RET you can find out what the current dictionary is." "Update the dictionary and the personal dictionary used by Ispell. This may kill the Ispell process; if so, a new one will be started when needed." - (let ((dict (or ispell-local-dictionary ispell-dictionary)) - (pdict (or ispell-local-pdict ispell-personal-dictionary))) + (let* ((dict (or ispell-local-dictionary ispell-dictionary)) + (pdict (or ispell-local-pdict ispell-personal-dictionary)) + (expanded-pdict (if pdict (expand-file-name pdict)))) (unless (and (equal ispell-current-dictionary dict) - (equal ispell-current-personal-dictionary pdict)) + (equal ispell-current-personal-dictionary + expanded-pdict)) (ispell-kill-ispell t) (setq ispell-current-dictionary dict - ispell-current-personal-dictionary pdict)))) + ispell-current-personal-dictionary expanded-pdict)))) ;; Avoid error messages when compiling for these dynamic variables. (defvar ispell-start) -- 2.30.2